package DomainModel;

/**
 *
 * @author Team2
 * 
 * 
 */
public enum Role
{
    ADMIN (3,"Admin"),
    PROF (2, "Professor"),
    STUD (1,"Student") ;
    
    private int roleId;
    private String roleName;
    private String defaultPage;
    
    private Role(int pRoleId, String pRoleName) {
        this.roleId = pRoleId;
        this.roleName = pRoleName;
        
        switch(pRoleId) {
            case 3: 
                defaultPage = "grs/adminUsers";
                break;
            case 2: 
            case 1: 
                defaultPage = "grs/viewCourseSections";
                break;
            default:
                break;
        }
    }
   
    public Role getRole() {
        return this;
    }
    
    public int getRoleId() {
        return this.roleId;
    }
    
    public String getRoleName() {
        return this.roleName;
    }
    
    public String getDefaultPage() {
        return this.defaultPage;
    }
    
    public static Role getRoleById(int pRoleId) {
        switch(pRoleId) {
            case 3: return Role.ADMIN;
            case 2: return Role.PROF;
            case 1: return Role.STUD;
        }
        
        return null;
    } 
}
